<%-- 
    Document   : modificarContratoHipoteca
    Created on : 27-ago-2009, 0:19:07
    Author     : Ale
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="domain.*,planner.*, java.util.Iterator, java.sql.Date"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>DOMECO</title>
        <link href="style.css" rel="stylesheet" type="text/css">

            <style type="text/css">@import url(./js/calendar-blue2.css);</style>
        <script type="text/javascript" src="./js/calendar.js"></script>
        <script type="text/javascript" src="./js/calendar-es.js"></script>
        <script type="text/javascript" src="./js/calendar-setup.js"></script>

        <script type="text/javascript">
//inicializo el calendario
window.onload = function() {
  Calendar.setup({
    inputField: "fecha",
    ifFormat:  "%Y-%m-%d",
    button:     "mas1"
  });

  Calendar.setup({
    inputField: "fechaExp",
    ifFormat:  "%Y-%m-%d",
    button:     "mas2"
  });

}
</script>
    </head>
    <body>

        <%if (request.getSession(false) != null) {%>
        <table align="center" width="1000" border="0">
            <tr>
                <td>
                    <div id="menu" align="center"><jsp:include page="./menu principal.jsp"></jsp:include></div>
                    <br>
                    <p id="campoAzul" align="center" valign="middle" width="235px"><span id="blanco">Hipotecas</span><br></p>
                    <span id="azulTitulo"> Nuevo Contrato de Hipoteca </span>
                    <div id="general">



                        <div id="cuenta" align="center" >

                            <form name="introducirCuenta" action="./Updater?type=mortgageCont&redir=H&idC=<%=request.getParameter("idMortgageContract")%>" method="post">
                                <table>
                                    <tr>
                                        <td><br></td>
                                    </tr>
                                    <tr>
                                        <td><span id="azul">Cuenta:</span></td>
                                        <td><select name="bank" id="bank">
                                                <%
    Userdom u = (Userdom) request.getSession().getAttribute("user");
    String id = request.getParameter("idMortgageContract");
    Integer i = Integer.parseInt(id);
    Mortgagecontract m = new Operations().getMortgageContract(i);
    int idCon = m.getContract().getIdContract();
    Iterator it = new Operations().getBankaccountsList(u).iterator();
    while (it.hasNext()) {
        Bankaccount b = (Bankaccount) it.next();

                                                %>
                                                <option  value="<% out.print(b.getIdBank());%>"><% out.print(b.getName());%></option>

                                                <%
    }
                                                %>
                                            </select>
                                        </td>
                                    </tr>
                                    <input name="idCon" type="hidden" value="<%=idCon%>">

                                    <tr>
                                        <td><br></td>
                                    </tr>
                                    <tr>
                                        <td><span id="azul">Nombre:</span></td>
                                        <td><input name="name" type="text" value="<%=m.getContract().getNameContract() %>"/></td>
                                    </tr>

                                    <tr>
                                        <td><br></td>
                                    </tr>
                                    <tr>
                                        <td><span id="azul">Fecha del Contrato:</span></td>
                                        <td><input name="fecha" id="fecha" class="fecha" type="text" value="<%=m.getContract().getDateContract() %>"  readonly="readonly"/></td>
                                        <td><button name="mas1" id="mas1" class="mas1"></button></td>
                                    </tr>

                                    <tr>
                                        <td><br></td>
                                    </tr>
                                    <tr>
                                        <td><span id="azul">Fecha finalización:</span></td>
                                        <td><input name="fechaExp" id="fechaExp" class="fechaExp" type="text" value="<%=m.getDateOfExpiration() %>" readonly="readonly"/></td>
                                        <td><button name="mas2" id="mas2" class="mas2"></button></td>
                                    </tr>

                                    <tr>
                                        <td><br></td>
                                    </tr>

                                    <tr>
                                        <td><span id="azul">Total a pagar:</span></td>
                                        <td><input name="total" type="text" value="<%=m.getTotal() %>"/></td>
                                    </tr>


                                    <tr>
                                        <td><br></td>
                                    </tr>

                                    <tr>
                                        <td><span id="azul">Intereses:</span></td>
                                        <td><input name="interes" type="text" value="<%=m.getInterest() %>"/></td>
                                    </tr>
                                    <tr>
                                        <td><br></td>
                                    </tr>



                                    <tr align="center">

                                        <td><input name="aceptar" type="submit" value="" id="aceptar"></td>
                                        <td><input type="button" value="" id="atras" onclick="javascript:history.back();"></td>
                                    </tr>

                                </table>

                                <br><br><br>
                            </form>
                        </div>
                    </div>
                                        <div id="abajo" align="center"><p>&copy;   Domeco &mdash; Proyecto Informático A&ntilde;o 2009 </p></div>

                </td>
            </tr>
        </table>

        <%} else {%>
        <jsp:forward page="./index.jsp"></jsp:forward>
        <%}%>
    </body>
</html>

